import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2022-12-11
 * Time: 11:04
 */
//k天之后，的日期
public class Test3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //月份天数
        int[] month = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        int y, m, d, k;
        y = scanner.nextInt();
        m = scanner.nextInt();
        d = scanner.nextInt();
        k = scanner.nextInt();

        for (int i = 1; i <= k; i++) {
            //判断闰年
            if ((y % 100 != 0 && y % 4 == 0) || (y % 400 == 0)) {
                //闰年
                month[2] = 29;
            }else {
                month[2] = 28;
            }
            //天数加1
            d++;
            //天数大于本月天数
            if (d == month[m] + 1) {
                //月数加一，天数变一
                d = 1;
                m++;
            }
            //月数大于12
            if (m == 13) {
                //年数加一，月数变一
                m = 1;
                y++;
            }
        }
        //打印格式，04%d，四位，不足前补0
        System.out.printf("%04d-%02d-%02d", y, m, d);
    }
}
